package concurrent.atomic;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicIntegerTest {
	
	public static void main(String[] args) throws InterruptedException {

		AtomicInteger atomicInteger = new AtomicInteger(100);
		System.out.println(atomicInteger.get());
		
		atomicInteger.set(88);
		System.out.println(atomicInteger.get());
		
		atomicInteger.compareAndSet(88, 77);
		System.out.println(atomicInteger.get());
		
		int result = atomicInteger.incrementAndGet();
		System.out.println(result);
		
		result = atomicInteger.getAndAdd(2);
		System.out.println(atomicInteger.get());
		
		result = atomicInteger.decrementAndGet();
		System.out.println(atomicInteger);
		
		result = atomicInteger.getAndAdd(-9);
		System.out.println(atomicInteger.get());
	}
}
